﻿// Inner Fire 游戏引擎库
// 纹理类
//
// Copyright (c) 2023 by 尔西大帝. All rights reserved.
//
// 用于纹理
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2024-11-22

#include "texture.h"
namespace ifire {
std::array<const CD3DX12_STATIC_SAMPLER_DESC, 6> GetStaticSamplers() {
  // Applications usually only need a handful of samplers.  So just define them
  // all up front and keep them available as part of the root signature.

  const CD3DX12_STATIC_SAMPLER_DESC pointWrap(0, // shaderRegister
      D3D12_FILTER_MIN_MAG_MIP_POINT,            // filter
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,           // addressU
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,           // addressV
      D3D12_TEXTURE_ADDRESS_MODE_WRAP);          // addressW

  const CD3DX12_STATIC_SAMPLER_DESC pointClamp(1, // shaderRegister
      D3D12_FILTER_MIN_MAG_MIP_POINT,             // filter
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,           // addressU
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,           // addressV
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP);          // addressW

  const CD3DX12_STATIC_SAMPLER_DESC linearWrap(2, // shaderRegister
      D3D12_FILTER_MIN_MAG_MIP_LINEAR,            // filter
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,            // addressU
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,            // addressV
      D3D12_TEXTURE_ADDRESS_MODE_WRAP);           // addressW

  const CD3DX12_STATIC_SAMPLER_DESC linearClamp(3, // shaderRegister
      D3D12_FILTER_MIN_MAG_MIP_LINEAR,             // filter
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,            // addressU
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,            // addressV
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP);           // addressW

  const CD3DX12_STATIC_SAMPLER_DESC anisotropicWrap(4, // shaderRegister
      D3D12_FILTER_ANISOTROPIC,                        // filter
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,                 // addressU
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,                 // addressV
      D3D12_TEXTURE_ADDRESS_MODE_WRAP,                 // addressW
      0.0f,                                            // mipLODBias
      8);                                              // maxAnisotropy

  const CD3DX12_STATIC_SAMPLER_DESC anisotropicClamp(5, // shaderRegister
      D3D12_FILTER_ANISOTROPIC,                         // filter
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,                 // addressU
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,                 // addressV
      D3D12_TEXTURE_ADDRESS_MODE_CLAMP,                 // addressW
      0.0f,                                             // mipLODBias
      8);                                               // maxAnisotropy

  return {pointWrap, pointClamp, linearWrap, linearClamp, anisotropicWrap,
      anisotropicClamp};
}

} // namespace ifire
